<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://sduept.security.el/func"
	template="/template/template.xhtml">
	<ui:define name="head">
		<title>#{request.getParameter('selectName')} 发电设备故障分析</title>
		<link rel="stylesheet"
			href="#{request.contextPath}/resources/plugins/datatables/dataTables.bootstrap.css" />
		<link
			href="#{request.contextPath}/resources/bootstrap/css/bootstrap-datetimepicker.min.css"
			rel="stylesheet" />
		<link
			href="#{request.contextPath}/resources/plugins/bootstrap-select/bootstrap-select.css"
			rel="stylesheet" />
		<style>
.no-padding {
	padding: 0 !important;
}

.row {
	margin-right: -15px;
	margin-left: -15px;
	width: 1668px;
}
</style>
	</ui:define>
	<ui:define name="content">
		<div class="full-center-content-scroll">
			<div class="box box-primary">
				<div style="height: 50px; padding-top: 10px;">
					<h:form id="queryForm1">
						<p:outputLabel value="查询时间：" style="margin-left:10px;" />
						<input type="text" id="firstYear"
							style="width: 80px; height: 30px; text-align: center; margin-right: 5px;" />
						<p:outputLabel value="至 ：" style="margin-left:10px;" />
						<input type="text" id="lastYear"
							style="width: 80px; height: 30px; text-align: center; margin-right: 5px;" />
						<p:outputLabel value="电压等级：" style="margin-left:10px;" />
						<h:selectOneMenu style="width:110px;height:30px" id="vol">
							<f:selectItem itemValue="0" itemLabel="220kV及以上"/>
							<f:selectItem itemValue="220" itemLabel="220kV" />
							<f:selectItem itemValue="500" itemLabel="500kV" />
						</h:selectOneMenu>
						<p:commandButton icon="ui-icon-search" value="查询"
							style="margin-left:10px;" onclick="initdatas();" />
					</h:form>
				</div>
			</div>
			<div class="chart tab-pane active" style="position: relative">
				<div style="overflow: auto; height: 750px">
					<div class="row">
						<div class="col-xs-12">
							<div class="box box-primary ">
								<div class="box-header with-border">
									<h3 id="run" class='box-title'></h3>
									<p:commandButton value="数据维护" icon="ui-icon-document"
										style="float:right" update="form:dataTable"
										rendered="#{s:hasPermission(session,'tjfx_sbgztjfx_fdsb_sjwh')}"
										oncomplete="PF('dataDlg').show()" />
								</div>
								<div class="box-body">
									<div id="fault_linebar" style="height: 350px; margin: 0 auto"></div>
								</div>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-xs-12">
							<div class="box box-primary">
								<div class="box-header with-border">
									<h3 id="year" class="box-title"></h3>
								</div>
								<div class="box-body">
									<div id="fault_pie"
										style="height: 350px; margin: 0 auto; text-align: center; color: grey; font-size: 16px; font-weight: bold"></div>
								</div>
							</div>
						</div>
					</div>
					<div class="row">
						<div class="col-xs-12">
							<div class="box box-primary">
								<div class="box-header with-border">
									<h3 id="tongji" class="box-title"></h3>
								</div>
								<div class="box-body">
									<div id="fault_barcharts"
										style="height: 350px; margin: 0 auto; text-align: center; color: grey; font-size: 16px; font-weight: bold"></div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<p:dialog widgetVar="dataDlg" header="发电机台数数据维护" modal="true"
			id="dataDlg" width="600" height="400"
			onHide="getLineFaultsCountData();">
			<h:form id="form">
				<p:toolbar id="toolbar">
					<f:facet name="left">
						<p:commandButton value="新建" icon="fa fa-plus"
							actionListener="#{electricityGenerationController.preCreat}"
							oncomplete="PF('createDlg').show()"
							update="createDlg form:dataTable" />
						<p:commandButton value="编辑" icon="fa fa-pencil"
							actionListener="#{electricityGenerationController.preEdit}"
							oncomplete="PF('createDlg').show()"
							update="createDlg  form:dataTable" id="edit"
							disabled="#{electricityGenerationController.select.id == null}" />
						<p:growl id="msgs" showDetail="true" />
						<p:commandButton value="删除" icon="fa fa-trash" update="msgs form"
							id="delete"
							disabled="#{electricityGenerationController.select.id == null}"
							actionListener="#{electricityGenerationController.deleteElectricityInfo}">
							<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
						</p:commandButton>
					</f:facet>
				</p:toolbar>
				<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
					<p:commandButton value="是" type="button"
						styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
					<p:commandButton value="否" type="button"
						styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
				</p:confirmDialog>
				<p:dataTable
					value="#{electricityGenerationController.electricityInfos}"
					var="act" paginator="true" id="dataTable" emptyMessage="无记录"
					rowKey="#{act.id}" rows="20" rowIndexVar="ite"
					selection="#{electricityGenerationController.select}"
					paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
					rowsPerPageTemplate="20,50,100" paginatorPosition="bottom"
					style="text-align:center;margin-top:3px">
					<f:facet name="{Customization}">
						<p:outputLabel
							value="总计：#{electricityGenerationController.electricityInfos.size()} 条记录"
							style="margin-right:20px;" />
					</f:facet>
					<p:ajax event="rowSelectRadio"
						listener="#{electricityGenerationController.onRowSelect}"
						update="form:edit  form:delete" />
					<p:column selectionMode="single" width="60"
						style="text-align:center" />
					<p:column width="60" headerText="序号">
						<h:outputText value="#{ite+1}" />
					</p:column>
					<p:column headerText="年" sortBy="#{act.year}">
						<h:outputLabel value="#{act.year}" />
					</p:column>
					<p:column headerText="电压等级">
						<h:outputLabel value="#{act.voltage}" />
					</p:column>
					<p:column headerText="发电机总数" sortBy="#{act.count}">
						<h:outputLabel value="#{act.count}" />
					</p:column>
				</p:dataTable>
			</h:form>
		</p:dialog>
		<p:dialog widgetVar="createDlg" header="新建" width="350"
			height="250">
			<h:form id="createDlg">
				<p:toolbar>
					<f:facet name="left">
						<p:commandButton value="保存" icon="ui-icon-disk"
							actionListener="#{electricityGenerationController.saveElectricityInfo}"
							update="form:msgs form:dataTable form:toolbar"
							oncomplete="PF('createDlg').hide()" />
					</f:facet>
				</p:toolbar>
				<p:outputPanel>
					<p:panelGrid columns="2">
						<p:outputLabel value="发电机总数" />
						<p:inputText label="content"
							value="#{electricityGenerationController.electricityInfo.count}" />
						<p:outputLabel value="年" />
						<p:inputNumber value="#{electricityGenerationController.year}"
							maxValue="2500" thousandSeparator="" decimalPlaces="0" />
						<p:outputLabel value="电压等级" />
						<h:selectOneMenu
							value="#{electricityGenerationController.voltage}"
							style="width: 120px;height:30px">
							<f:selectItem itemValue="500" itemLabel="500kV" />
							<f:selectItem itemValue="220" itemLabel="220kV" />
							<f:selectItem itemValue="0" itemLabel="220kV及以上" />
						</h:selectOneMenu>
					</p:panelGrid>
				</p:outputPanel>
			</h:form>
		</p:dialog>
	</ui:define>
	<ui:define name="contentend">
		<script src="#{request.contextPath}/resources/js/jquery-migrate.min.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/datatables/jquery.dataTables.min.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/datatables/dataTables.bootstrap.min.js"></script>
		<script src="#{request.contextPath}/resources/js/tables/mytable.js"></script>
		<script src="#{request.contextPath}/resources/js/mycharts/charts.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/echarts/echarts.js"></script>
		<script
			src="#{request.contextPath}/resources/js/mycharts/categoryBarChart.js"></script>
		<script src="#{request.contextPath}/resources/js/array-util.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/jQueryUI/jquery-ui.js"></script>
		<script
			src="#{request.contextPath}/resources/bootstrap/js/bootstrap-datetimepicker.min.js"></script>
		<script
			src="#{request.contextPath}/resources/bootstrap/js/bootstrap3-typeahead.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/pinyin/pinyin_dict_firstletter.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/pinyin/pinyinUtil.js"></script>
		<script
			src="#{request.contextPath}/resources/plugins/bootstrap-select/bootstrap-select.js"></script>
		<script src="#{request.contextPath}/resources/js/mycharts/pieChart.js"></script>
		<script src="faultEquipmentStatisticsEcharts.js"></script>
		<script src="electricityGeneration.js"></script>
	</ui:define>
</ui:composition>